package com.linran.gclearn.jvm.oom;

import java.util.ArrayList;
import java.util.List;

/**
 * -Xms:20m -Xmx:20m -XX:+HeapDumpOnOutOfMemoryError
 * 初始堆大小20m  最大堆大小20m  内存溢出时dump内存快照
 */
public class HeapOOM {
    static class OOMObject {
    }

    public static void main(String[] args) {
        List<OOMObject> reference = new ArrayList<>();
        while (true) {
            reference.add(new OOMObject());
        }
    }
}
